package cyy.example.com.facotry.net;


import java.util.List;
import java.util.Map;

import cyy.example.com.facotry.model.api.BaseEntity;
import cyy.example.com.facotry.model.api.MyPublishListEntity;
import cyy.example.com.facotry.model.api.request.CheckUserEntity;
import cyy.example.com.facotry.model.api.request.ClockedInEntity;
import cyy.example.com.facotry.model.api.request.EditUserInfoEntity;
import cyy.example.com.facotry.model.api.request.LoginEntity;
import cyy.example.com.facotry.model.api.request.SendTaskEntity;
import cyy.example.com.facotry.model.api.request.UpLocationInfo;
import cyy.example.com.facotry.model.api.request.UpReportEntity;
import cyy.example.com.facotry.model.api.request.UserRegisterEntity;
import cyy.example.com.facotry.model.api.response.AverageEntity;
import cyy.example.com.facotry.model.api.response.BannerEntity;
import cyy.example.com.facotry.model.api.response.ClockInsDetailsEntity;
import cyy.example.com.facotry.model.api.response.ConfigEntitySpare;
import cyy.example.com.facotry.model.api.response.FirmDeviceInfoBean;
import cyy.example.com.facotry.model.api.response.FirmGeneralInfoEntity;
import cyy.example.com.facotry.model.api.response.FirmLatestOverDataEntity;
import cyy.example.com.facotry.model.api.response.FirmListEntity;
import cyy.example.com.facotry.model.api.response.FirmLocationEntity;
import cyy.example.com.facotry.model.api.response.FirmNameByIdEntity;
import cyy.example.com.facotry.model.api.response.HistoryDataEntity;
import cyy.example.com.facotry.model.api.response.InstitutionEntity;
import cyy.example.com.facotry.model.api.response.MissionLocationEntity;
import cyy.example.com.facotry.model.api.response.MyTaskListInfoEntity;
import cyy.example.com.facotry.model.api.response.PeopleTranceEntity;
import cyy.example.com.facotry.model.api.response.PublishFilesEntity;
import cyy.example.com.facotry.model.api.response.RealDataEntity;
import cyy.example.com.facotry.model.api.response.ReportEntity;
import cyy.example.com.facotry.model.api.response.SearchMenuEntity;
import cyy.example.com.facotry.model.api.response.StaffDetailsEntity;
import cyy.example.com.facotry.model.api.response.StaffEntity;
import cyy.example.com.facotry.model.api.response.StaffLocationInfoEntity;
import cyy.example.com.facotry.model.api.response.StreetAndFirmEntity;
import cyy.example.com.facotry.model.api.response.TaskActionGroupEntity;
import cyy.example.com.facotry.model.api.response.TaskDetailsInfoEntity;
import cyy.example.com.facotry.model.api.response.TaskFileAndReportListEntity;
import cyy.example.com.facotry.model.api.response.TaskFileEntity;
import cyy.example.com.facotry.model.api.response.TaskFileListEntity;
import cyy.example.com.facotry.model.api.response.TaskInfoEntity;
import cyy.example.com.facotry.model.api.response.TaskReportListEntity;
import cyy.example.com.facotry.model.api.response.TaskStatuEntity;
import cyy.example.com.facotry.model.api.response.TaskUserGroupEntity;
import cyy.example.com.facotry.model.api.response.UnnormalFacilityEntity;
import cyy.example.com.facotry.model.api.response.UpVersionEntity;
import cyy.example.com.facotry.model.api.response.UserEntity;
import cyy.example.com.facotry.model.api.response.UserRealNameAndIdEntity;
import cyy.example.com.facotry.model.api.response.VideoInfoEntity;
import cyy.example.com.facotry.model.api.response.WarnCountEntity;
import cyy.example.com.facotry.model.api.response.WarningFirmEntity;
import cyy.example.com.facotry.model.api.response.WifiWarnBean;
import cyy.example.com.facotry.model.api.response.WifyCountEntity;
import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.Query;
import retrofit2.http.QueryMap;
import retrofit2.http.Streaming;
import retrofit2.http.Url;

/**
 * 网络请求的所有的接口
 *
 * @author qiujuer Email:qiujuer@live.cn
 * @version 1.0.0
 */
public interface RemoteService {

    /**
     * 条件搜索相关公司
     *
     * @param map        所搜条件
     * @param areaName   地区
     * @param industryId 身份
     * @return
     */
    @GET("companyData/getCompanyData")
    Call<FirmListEntity> queryClassfyFirmList(@QueryMap(encoded = true) Map<String, String> map,
                                              @Query("areaName") List<String> areaName,
                                              @Query("industryId") List<String> industryId);

    /**
     * 地图任务信息列表
     *
     * @return
     */
    @GET("/environment-app/task/center/monitoring/getMapTaskInfo")
    Call<BaseEntity<List<MissionLocationEntity.BodyBean>>> queryMapTaskInfoList();

    /**
     * app在线人员位置
     *
     * @return
     */
    @GET("accounts/user/getUserLocation")
    Call<BaseEntity<List<StaffLocationInfoEntity>>> queryMapPeoleInfoList();


    /**
     * 位置上传
     *
     * @return
     */
    @POST("accounts/user/saveUserLocation")
    Call<BaseEntity> upMyLocation(@Body UpLocationInfo info);


    /**
     * 获取与我相关的任务
     *
     * @param taskStatus 任务状态
     * @param pageSize   每页拉取的数目
     * @param pageNum    页数
     * @param sortType   排序类型
     * @param areaName   地区
     * @param industryId 行业类型
     * @return
     */
    @GET("taskManage/getTaskInfoByKey")
    Call<MyTaskListInfoEntity> getTaskInfo(@Query(value = "userId") String userId,
                                           @Query(value = "taskStatus") String taskStatus,
                                           @Query(value = "pageSize") int pageSize,
                                           @Query(value = "pageNum") int pageNum,
                                           @Query(value = "sortType") String sortType,
                                           @Query("areaName") List<String> areaName,
                                           @Query("taskType") List<String> industryId);

    /**
     * 获取指定的区内的所有公司
     */
    @GET("taskManage/getStreetAndCompanyName")
    Call<StreetAndFirmEntity> getStreentAndFirm();

    /**
     * 获取任务执行人员分组信息
     */
    @GET("taskManage/getUserByRoleType")
    Call<TaskActionGroupEntity> getTakeTaskGroup();


    /**
     * 接收任务
     *
     * @param userId     用户id
     * @param taskNumber 任务编号
     */
    @FormUrlEncoded
    @POST("taskManage/receiveTask")
    Call<TaskStatuEntity> receiveTask(@Field(value = "userId", encoded = true) String userId,
                                      @Field(value = "taskNumber", encoded = true) String taskNumber);

    /**
     * 派发任务
     *
     * @param userId     用户id
     * @param taskNumber 任务编号
     */
    @FormUrlEncoded
    @POST("taskManage/executeTask")
    Call<TaskStatuEntity> executeTask(@Field(value = "userId", encoded = true) String userId,
                                      @Field(value = "taskNumber", encoded = true) String taskNumber);

    /**
     * 获取审批任务的文件
     */
    @GET("taskManage/getTaskExecuteFiles")
    Call<TaskFileEntity> getCheckTakeFile(@Query(value = "taskNumber") String taskNumber);


    /**
     * 审核任务
     *
     * @param userId     用户id
     * @param taskNumber 任务编号
     * @param opinionMsg 审核意见
     * @param isPass     是否通过审核: 0不通过1通过
     * @return
     */
    @FormUrlEncoded
    @POST("taskManage/checkTask")
    Call<BaseEntity> CheckTask(@Field(value = "userId", encoded = true) String userId,
                               @Field(value = "taskNumber", encoded = true) String taskNumber,
                               @Field(value = "opinionMsg", encoded = true) String opinionMsg,
                               @Field(value = "isPass", encoded = true) String isPass);


    /**
     * 版本更新
     */
//    @GET()
    @GET("system/config/getAppVersion")
    Call<BaseEntity<UpVersionEntity>> upAPPVersion(@Query(value = "verClientType") String verClientType, @Query(value = "currentVersion") String currentVersion);


    /**
     * 获取超标企业 位置
     */
    @GET("company/cpoll/app/getUnusualCompany")
    Call<BaseEntity<WarningFirmEntity>> getWarnFirm();


    /**
     *
     */
    @POST("accounts/user/saveUserCoordinate")
    Call<BaseEntity> UserClockIn(@Body ClockedInEntity entity);


    /**
     * 打卡
     */
    @GET("accounts/user/getUserTrackDate")
    Call<BaseEntity<List<String>>> getUserTrackDate(@Query(value = "userId") String userId);

    /**
     * 获取打卡的地点
     */
    @GET("accounts/user/getUserTrack")
    Call<BaseEntity<List<PeopleTranceEntity>>> getUserTrack(@Query(value = "userId") String userId,
                                                            @Query(value = "beginTime") long beginTime,
                                                            @Query(value = "endTime") long endTime);

    /**
     * 获取打卡的详情
     */
    @GET("accounts/user/getCoordinateById")
    Call<BaseEntity<ClockInsDetailsEntity>> getUserTrackDet(@Query(value = "userId") String userId,
                                                            @Query(value = "beginTime") String beginTime,
                                                            @Query(value = "endTime") String endTime,
                                                            @Query(value = "pageSize") int pageSize,
                                                            @Query(value = "pageNum") int pageNum);


    /**
     * 获取公司详情信息
     */
    @GET("")
    Call<BaseEntity> queryFirmDetails(@Url String url);

    /**
     * 获取所有站位最新超标数据
     */
    @GET("rd/process/overprofListByCompany")
    Call<BaseEntity<FirmLatestOverDataEntity>> getOverproofFirmDetails(@Query(value = "companyId") String companyId);

    /**
     * 搜索相关的公司名称和id
     */
    @GET("company/cpoll/getCompanyNameByKey")
    Call<BaseEntity<List<FirmNameByIdEntity>>> getSearchFirmById(@Query(value = "companyName") String companyName);

    /**
     * 获取我发布的信息
     *
     * @param pageNum    分页的页数
     * @param pageSize   每页的数目
     * @param createName 发布人
     * @return
     */
    @GET("company/issue/IRelease")
    Call<BaseEntity<List<MyPublishListEntity>>> getMyPublishList(@Query(value = "pageNum") int pageSize, @Query(value = "pageSize") int pageNum, @Query(value = "createName") String createName);

    /**
     * 修改信息
     */
    @POST("accounts/user/mobileModify")
    Call<BaseEntity> editPersonalInfo(@Body EditUserInfoEntity datas);

    /**
     * 获取轮播图
     */
    @GET("system/config/getSystemRotationPicture")
    Call<BaseEntity<List<BannerEntity>>> getBannerList();


    /**
     * 获取系统配置
     *
     * @return
     */
    @GET("system/config/getGlobalConfig")
    Call<BaseEntity<ConfigEntitySpare>> getConfig();

    @GET("system/config/getStaticSystemConstants")
    Call<BaseEntity<List<SearchMenuEntity>>> getSearchMenuConfig();


    @GET()
    Call<BaseEntity<HistoryDataEntity>> getRealData();

    /**
     * @Url String url
     */
    @GET("company/companyData/getCompanyVideo")
    Call<BaseEntity<VideoInfoEntity>> getVideoUrl(@Query(value = "companyId") String companyId);


    /**
     * 获取公司详情信息
     *
     * @return
     */
    @GET("company/companyData/getCompanyDetailHBXX")
    Call<BaseEntity<FirmGeneralInfoEntity>> queryFirmGeneralInfo(@Query(value = "companyId") String id);

    /**
     * 公司列表
     */
    @GET("company/companyData/getCompanyData")
    Call<BaseEntity<List<FirmListEntity>>> queryFirmList(@QueryMap(encoded = true) Map<String, String> map,
                                                         @Query("businessType") List<String> businessType,
                                                         @Query("regulationType") List<String> regulationType,
                                                         @Query("regulationLevel") List<String> regulationLevel);

    /**
     * 公司站位列表
     */
    @GET("company/companyData/getCompanywatchsite")
    Call<BaseEntity<List<InstitutionEntity>>> getInstitutionList(@Query(value = "companyId") String id);

    /**
     * 登陆接口
     *
     * @param entity 实体数据
     * @return
     */
    @POST("access/mobile/login")
    Call<BaseEntity<UserEntity>> login(@Body LoginEntity entity);


    /**
     * 获取历史数据
     *
     * @param siteCode
     * @return
     */
    @GET("rd/real/list")
    Call<BaseEntity<HistoryDataEntity>> getRealData(@QueryMap Map<String, String> siteCode);

    /**
     * 获取所有企业的位置
     */
    @GET("company/companyData/getCompanyLocations")
    Call<BaseEntity<List<FirmLocationEntity>>> getAllFirmLocation();

    /**
     * 获取用户列表
     */
    @GET("accounts/user/list")
    Call<BaseEntity<StaffEntity>> getStaffList(@QueryMap Map<String, String> siteCode, @Query("userType") List<String> userType,
                                               @Query("roleId") List<String> roleId, @Query("ispass") String ispass);

    /**
     * 查询用户详情
     *
     * @param userId 用户id
     * @return
     */
    @GET("accounts/user/detail/info")
    Call<BaseEntity<StaffDetailsEntity>> getStaffDetails(@Query(value = "userId") String userId);

    /**
     * 获取最新的实时数据
     *
     * @param siteCode
     * @return
     */
    @GET("rd/statistic/list")
    Call<BaseEntity<List<RealDataEntity>>> getFirmLatestData(@QueryMap Map<String, String> siteCode);

    /**
     * 获取最新的实时数据
     *
     * @param companyId id
     */
    @GET("rd/process/unusualSiteByCompany")
    Call<BaseEntity<UnnormalFacilityEntity>> getUnnormalFacilityInfo(@Query(value = "companyId") String companyId);

    /**
     * 上传用户身份证
     *
     * @return
     */
    @POST("access/modifyIdCard")
    Call<BaseEntity<String>> upUserIdCard(@Body Map<String, String> map);

    /**
     * 获取某个发布内容的文件
     *
     * @return
     */
    @GET("company/issue/seeFilePath")
    Call<BaseEntity<PublishFilesEntity>> getPublishFile(@Query("recId") String recId);

    /**
     * 获取某个发布内容的文件
     * rd/statistic/avg
     *
     * @return
     */
    @GET("rd/statistic/avg")
    Call<BaseEntity<AverageEntity>> getAverageValue(@QueryMap Map<String, String> map);

    @GET("task/center/getTaskListApp")
    Call<BaseEntity<TaskInfoEntity>> getTaskList(@Query(value = "pageSize") String pageSize, @Query(value = "pageNum") String pageNum);

    @GET("accounts/user/selectUsers")
    Call<BaseEntity<List<TaskUserGroupEntity>>> getTaskUserGroup(@Query(value = "regionCode") String regionCode, @Query(value = "histologicType") String histologicType);


    @GET("company/listDevice")
    Call<BaseEntity<List<FirmDeviceInfoBean>>> getDevicesList(@QueryMap Map<String, String> map);

    /**
     * 派发任务
     */
    @POST("task/center/add")
    Call<BaseEntity> SendTask(@Body SendTaskEntity body);

    /**
     * 派发任务
     */
    @POST("task/center/receive")
    Call<BaseEntity> doTakeTask(@Body Map<String, String> map);


    /**
     * 派发任务
     */
    @GET("task/center/getTaskDefeated")
    Call<BaseEntity<TaskInfoEntity>> getOverdueTask(@Query(value = "pageSize") String pageSize, @Query(value = "pageNum") String pageNum);

    /**
     * 获取报表
     */
    @GET("system/inputform/theFormDetails")
    Call<BaseEntity<ReportEntity>> getTaskReport(@Query(value = "formCode") String formCode);

    /**
     * 派发任务
     */
    @GET("task/center/issueStatementList")
    Call<BaseEntity<List<TaskReportListEntity>>> getTaskReportList(@Query(value = "taskNumber") String taskNumber);

    /**
     * 清除已上传的报表值
     */
    @POST("task/center/delStatement")
    Call<BaseEntity> cleanTaskReportResult(@Body Map<String, String> siteCode);

    /**
     * 获取已上传过值的报表
     */
    @GET("task/center/statementDetails")
    Call<BaseEntity<List<ReportEntity>>> getReportDetlAndValue(@Query(value = "taskNumber") String taskNumber, @Query(value = "formCode") String formCode);


    /**
     * 上传任务表格
     */
    @POST("task/center/issueStatement")
    Call<BaseEntity> upLoadReport(@Body UpReportEntity entity);

    /**
     * 更新任务表格
     */
    @POST("task/center/modifierStatement")
    Call<BaseEntity> upDataReport(@Body UpReportEntity entity);

    /**
     * 更新任务表格
     */
    @GET("task/center/attachmentList")
    Call<BaseEntity<TaskFileListEntity>> getTaskFiles(@Query(value = "taskNumber") String taskNumber);

    /**
     * 获取任务表格及文件
     */
    @GET("task/center/getTaskFileApp")
    Call<BaseEntity<TaskFileAndReportListEntity>> getTaskFilesAndReport(@Query(value = "taskNumber") String taskNumber);


    /**
     * 提交审核
     */
    @POST("task/center/submitAudit")
    Call<BaseEntity> doSubmitAudit(@Body Map entity);

    /**
     * 审核通过
     */
    @POST("task/center/pass")
    Call<BaseEntity> taskAuditPass(@Body Map entity);

    /**
     * 任务驳回
     */
    @POST("task/center/reject")
    Call<BaseEntity> taskAuditReject(@Body Map entity);

    /**
     * 查询任务详情
     */
    @GET("task/center/taskBasicInformation")
    Call<BaseEntity<TaskDetailsInfoEntity>> getTaskDetailsInfo(@Query(value = "taskNumber") String taskNumber, @Query(value = "histologicType") String histologicType);

    /**
     * 修改待接收任务 未接收
     */
    @POST("task/center/modifyTask")
    Call<BaseEntity<TaskDetailsInfoEntity>> alterNoAcceptTask(@Body Map map);

    /**
     * 修改待接收任务 未接收
     */
    @POST("task/center/remove")
    Call<BaseEntity<TaskDetailsInfoEntity>> deleteTaskTask(@Body Map map);

    /**
     * 注册用户
     */
    @POST("accounts/user/add")
    Call<BaseEntity> userRegister(@Body UserRegisterEntity map);

    /**
     * 获取用户真是姓名及id
     */
    @GET("accounts/user/inquireUserId")
    Call<BaseEntity<UserRealNameAndIdEntity>> getUserIdAndName(@Query(value = "username") String username);

    /**
     * 审核用户
     */
    @POST("accounts/user/audit")
    Call<BaseEntity> checkUser(@Body CheckUserEntity map);

    /**
     * 下载文件
     */
    @GET
    @Streaming
    Call<ResponseBody> downloadFile(@Url String url);

    @GET("/environment-app/company/warning/count")
    Call<BaseEntity<WarnCountEntity>> getWarnCount();

    @GET("/environment-app/watchsiteOffline/app/queryWatchsiteOfflineCounts")
    Call<BaseEntity<String>> getWifiWarnCount();

    @GET("/environment-app/watchsiteOffline/app/queryWatchsiteOfflineListByPage")
    Call<BaseEntity<List<WifiWarnBean>>> getQueryOfflineList(@Query(value = "pageNum") int pageNum,
                                                       @Query(value = "pageSize") int pageSize);
}